package com.tyj.movie.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tyj.movie.entity.AdministrativeRegion;
import com.tyj.movie.service.AdministrativeRegionService;
import com.tyj.movie.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tyj
 * @since 2021-06-28
 */
@RestController
@RequestMapping("/movie/administrativeRegion")
public class AdministrativeRegionController {

    @Autowired
    AdministrativeRegionService administrativeRegionService;

    @RequestMapping("/get/{cityId}")
    public R getAdministrativeRegion(@PathVariable Integer cityId){
        List<AdministrativeRegion> list = administrativeRegionService.list(new QueryWrapper<AdministrativeRegion>().eq("city_id", cityId));
        R ok = R.ok(list);
        return ok;
    }

}

